#pragma once

#include <DarkGDK.h>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "TGameObject.h"
#include "IClickable.h"

using std::string;
using std::vector;
using std::map;
#define ACTIVE_COLOR RGB(255,255,255)
#define NORMAL_COLOR RGB(150,150,150)
#define TEXT_COLOR RGB(0,0,0)
#define HOVER_COLOR RGB(255,0,0)

class TextBox : public TGameObject, public IClickable
{
	RECT m_Rect;		
    string strAction;
        
    static HHOOK hook;
    static LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam);
    DWORD ActiveColor;
    DWORD NormalColor;
    DWORD TextColor;
public:
	static vector<TextBox *> lst;
    static TextBox *ActiveTextBox;
	TextBox(int x, int y, int width);	
	virtual ~TextBox();	

    virtual void OnDraw();

    virtual void OnClick( int x, int y );

    virtual RECT* GetRect();    

    virtual void OnHover( int x, int y );

    LPCSTR GetText() const { return strAction.c_str(); };

    void SetText(string txt) { strAction = txt; };

    virtual TGDKSprite* GetMainSprite();

    virtual void OnLeave();

    int GetWidth() { return m_Rect.right - m_Rect.left ;};

    int GetHeight() { return m_Rect.bottom - m_Rect.top; };

    void SetPosition(int x, int y);
};